package com.example.a33mvvm.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.a33mvvm.R;
import com.example.a33mvvm.utils.ImageLoader;
import com.example.base_mvvm.entity.HomeVideoEntity;

import java.util.List;

public class HomeVideoAdapter extends BaseQuickAdapter<HomeVideoEntity.DataBean, BaseViewHolder> {
    public HomeVideoAdapter(@Nullable List<HomeVideoEntity.DataBean> data) {
        super(R.layout.homevideo_item, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, HomeVideoEntity.DataBean dataBean) {
        ImageView view = baseViewHolder.getView(R.id.homeVideo_iv);
        ImageLoader.getInstance().LoadCircleImage(getContext(),dataBean.getHeadpath(),view);
        if(dataBean.getDianzan() == 0){
            baseViewHolder.setImageResource(R.id.homeVideo_like,R.drawable.ic_xihuan);
        }else {
            baseViewHolder.setImageResource(R.id.homeVideo_like,R.drawable.ic_xihuanred);
        }
    }
}
